home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / cheetah.zip / SCREEN.H < prev    next >
C/C++ Source or Header  |  1992-08-20  |  5KB  |  141 lines

  1. /* screen.h        SCREEN library
  2.  * Description:
  3.  *      Screen operations.
  4.  * Portability: ANSI
  5.  *                                      (c) erdy 1992
  6.  * $Header: $
  7.  */
  8. #ifndef _SCREEN_H_
  9. #       define _SCREEN_H_
  10. #ifndef _VGAPREFIX_H_
  11. #       include "vgaprefx.h"
  12. #endif  _VGAPREFIX_H_
  13. #include "image.h"              /* Include image definition */
  14.  
  15. typedef char color_t;
  16.  
  17. /*
  18.  * Constants, options, ...
  19.  */
  20. /*#define ZC_PREPARED             /* Option: format of putZCompact args */
  21. #define ZC_CMAPSIZE 64
  22. #define ER_OUTOFMEM 1
  23. #define ER_OUTOFMAP 2
  24.  
  25. /* Sizes of RAM animation buffer, for decoding Z4Planes image into. */
  26. /*#ifndef Z4P_RAMWIDTH    /* Width, MUST be N*4 */
  27. /*#ifndef Z4P_RAMHEIGHT   /* Height */
  28.  
  29. /*
  30.  * Types:
  31.  * ------
  32.  */
  33. /* Request for blocked drawings. */
  34. typedef struct {
  35.         unsigned        dr_seg;            /* Limb segment */
  36.         unsigned        dr_imageo;         /* Image offset */
  37.         int             dr_offset;         /* VRAM offset */
  38.         int             dr_plane;          /* staring plane */
  39.         int             dr_rows;           /* rows in image */
  40. } draw_request;
  41.  
  42. /*
  43.  * Globals:
  44.  */
  45. extern int scerror;
  46. extern int screen_xband;   /* Horizontal screen band (hor scrolling) */
  47. extern int screen_x;       /* Current x offset of screen frame in screen band */
  48.  
  49. /*
  50.  * Functions:
  51.  */
  52. #ifdef VGA_UNCHAINED
  53. #       define putZCompact UputZCompact
  54. #       define getZCompact UgetZCompact
  55. #       define getZ4Planes UgetZ4Planes
  56. #       define putZ4Planes UputZ4Planes
  57. #       define getZPacked  UgetZPacked
  58. #       define putZPacked  UputZPacked
  59. #else  VGA_UNCHAINED
  60. #       define putZCompact CputZCompact
  61. #       define getZCompact CgetZCompact
  62. #       define getZ4Planes CgetZ4Planes
  63. #       define putZ4Planes CputZ4Planes
  64. #       define getZPacked  CgetZPacked
  65. #       define putZPacked  CputZPacked
  66. #endif VGA_UNCHAINED
  67.  
  68. #ifdef ZC_PREPARED
  69.         void UputZCompact(char far *image, int mask, int offset, int rows);
  70.         void CputZCompact(char far *image, int mask, int offset, int rows);
  71. #else
  72.         void UputZCompact(char far *image, int x, int y, int rows);
  73.         void CputZCompact(char far *image, int x, int y, int rows);
  74. #endif ZC_PREPARED
  75.  
  76. #ifndef Z4P_RAMWIDTH
  77. void MputZ4Planes(char far *image,int rows,unsigned segment,unsigned offset,
  78.                 unsigned planewidth, unsigned char planeintl);
  79. #else   Z4P_RAMWIDTH
  80. void MputZ4Planes(char far *image, int rows, unsigned segment, unsigned offset);
  81. #endif  Z4P_RAMWIDTH
  82.  
  83. Image far *CgetZCompact(unsigned int x, unsigned int y, int nc, int nr, int backcolor);
  84. Image far *UgetZCompact(unsigned int x, unsigned int y, int nc, int nr, int backcolor);
  85. void UputZ4Planes(char far *image, unsigned x, unsigned y, int rows);
  86. void CputZ4Planes(char far *image, unsigned x, unsigned y, int rows);
  87. Image far *CgetZ4Planes(unsigned int x, unsigned int y, unsigned int nc, unsigned int nr, int backcolor);
  88. void UZ4PRequest(draw_request *dp, int nreq);
  89. Image far *CdifZ4Planes(unsigned int x, unsigned int y,
  90.                         unsigned int nc, unsigned int nr, char far *ptr_prim);
  91. void CputZPacked(char far *image, unsigned x, unsigned y, int rows);
  92. Image far *CgetZPacked(unsigned int x, unsigned int y, unsigned int nc, unsigned int nr, int backcolor);
  93. Image far *CdifZPacked(unsigned int x, unsigned int y,
  94.                         unsigned int nc, unsigned int nr, char far *ptr_prim);
  95. void setPalette(char far *p);
  96. void setPartPalette(char far *p, int first, int count);
  97. char far *loadPalette(char *filename);
  98. int palette(char *filename);
  99. int storeImage(int d, Image far *Ip);
  100. Image far * restoreImage(int d);
  101. Image far * readZfile(char *name);
  102. int writeZfile(char *name, Image far *);
  103. void putImage(Image far *ip, int x, int y);
  104. char getPixel(unsigned int x, unsigned int y);
  105. void putPixel(unsigned int x, unsigned int y, char color);
  106. void copyBlock(unsigned int sseg,unsigned int soff,unsigned int dseg,unsigned int doff,
  107.         int width, int height,unsigned int ramwidth, unsigned int ramheight);
  108. void drawRectangle(unsigned int left, unsigned int top,
  109.                 unsigned int width, unsigned int height, char color);
  110. void fillRectangle(unsigned int left, unsigned int top,
  111.                 unsigned int width, unsigned int height, char color);
  112. void drawHline(unsigned int left, unsigned int top, unsigned int width, char color);
  113. void drawVline(unsigned int left, unsigned int top, unsigned int height, char color);
  114. void hscroll(int shift);
  115. void hscrollinit(void);
  116. void grswitch(int);
  117. void screenMode(int);
  118. void copyScPage(unsigned int);
  119. void clearScPage(unsigned int, color_t);
  120. void screenOff(void), screenOn(void);
  121.  
  122. /* Other functions: */
  123. void far *regetmem(void far *, unsigned long sz);
  124. void far *getmem(unsigned long sz);
  125. void retmem(void far *p);
  126. long querymem(void);
  127. #if defined(__SMALL__) || defined(__TINY__) || defined(__MEDIUM__)
  128. int _fread(int, void far *, unsigned int);
  129. int _fwrite(int, void far *, unsigned int);
  130. #else
  131. #include <io.h>
  132. #define _fread _read
  133. #define _fwrite _write
  134. #endif
  135. int _lfread(int d, void far *p, unsigned long size);
  136. int _lfwrite(int d, void far *p, unsigned long size);
  137. int readDump(char *filename);
  138. void getOrigin(int *xp, int *yp, int *wp, int *hp, char bg);
  139. extern int Scsignal;
  140. extern int Scmode;
  141. #endif _SCREEN_H_